Skip to content

Semantic column-type inference + override UI [prototype]#144

Draft
jeanbez wants to merge 3 commits into
developfrom
prototype-column-roles
Draft

Semantic column-type inference + override UI [prototype]#144
jeanbez wants to merge 3 commits into
developfrom
prototype-column-roles

Conversation

@jeanbez

@jeanbez jeanbez commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Draft / prototype — scoped to the web Data Overview panel. Opening for review of the approach before wiring the rest of the app.

Problem

Metrics classify columns by raw pandas dtype, so numeric columns that are really categorical codes (e.g. a class label flavor = -1/1/2/5/21) or identifiers (e.g. a near-unique jetIndex) get summarized as continuous measurements — meaningless means/percentiles, KDE plots, and correlations.

What this does

Introduces a semantic role per column — continuous / categorical / identifier — inferred from dtype + cardinality (+ a light id-name hint), with a user override.

  • infer_column_roles(df, overrides) helper (web/routes/utils.py) — cardinality/name heuristic with small-dataset guards; overrides win.
  • /summary-statisticsdescribe() over continuous columns only; value-count bar charts for categoricals (a KDE of a discrete code is meaningless); identifiers listed and excluded from stats/plots.
  • /column-roles endpoint — persists per-session overrides; roles reset on new upload; applying an override busts cached metric results.
  • "Override Column Types" panel in Data Overview — per-column role dropdowns with a search box and a 14-row cap ("+N more") so it stays usable on wide (100+ column) datasets.
  • Unit tests for the heuristic, including small-dataset guards.

Scope / follow-ups (not in this PR)

  • Web-only. CLI, Globus, and the PyPI library are untouched (they don't import web/), so no regression — but they don't benefit yet and now differ from the web UI.
  • Next steps discussed: relocate the helper into the aidrin/ package so all surfaces share one source of truth; add string-identifier detection (UUIDs/hashes); wire the metrics themselves to consume roles (esp. privacy, where identifiers are input, not noise); and address distributions-at-scale (100 cols → 90 plots on one page).

Testing

  • 382 unit + integration tests pass.
  • Manually verified in-browser on a 7-column physics parquet and a synthetic 100-column dataset (roles inferred correctly; override → recompute works; controls sized/centered consistently).

Prototype: classify each column as continuous / categorical / identifier
by dtype + cardinality (+ id-name hint) instead of raw dtype, so numeric
codes (e.g. class labels) and identifiers (e.g. unique keys) aren't
summarized as continuous measurements.

- infer_column_roles(df, overrides) helper in web/routes/utils.py
- /summary-statistics: describe() over continuous only; value-count bars
  for categoricals; identifiers listed and excluded from stats/plots
- /column-roles endpoint persists per-session overrides; roles reset on
  new upload; overrides bust cached metric results
- Data Overview 'Override Column Types' panel: per-column role dropdowns
  with search + 14-row cap for wide datasets, Apply recomputes
- unit tests for the inference heuristic (incl. small-dataset guards)

Web-only for now; CLI/Globus/library unaffected (see follow-ups).
@jeanbez jeanbez changed the title Semantic column-type inference + override UI (Data Overview) [prototype] Semantic column-type inference + override UI [prototype] Jul 2, 2026
jeanbez added 2 commits July 1, 2026 17:59
…sting E231

- utils.py: move multi-line threshold comments to own lines (E114/E116)
- inspector.js: prettier --write formatting
- retriever.py: add missing space after comma (E231, pre-existing on develop)
@jeanbez

jeanbez commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator Author

@kaveenh this is the draft of that feature we discussed, please go ahead and see what needs changed and replicated to the other interfaces

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant